import {createStore} from 'vuex'
import moduleB from './modules/modulesB'

export default createStore({
    modules:{
        b:moduleB

    },
    state:{
        count:520,
        test:'靓仔！'
    },
    getters:{
        countAdd1314:(state)=>{
            return state.count + 1314
        }
    },
    mutations:{
        add(state){
            state.count++
        },
        addPlayload(state,playload){
            state.count += playload.num
        }
    },
    actions:{
        addAction(context){
            context.commit('add')
        },
        asyncAddAction({commit}){
            setTimeout(()=>{
                commit('add')
            },1000)
        },
        asyncAddPlayloadAction({commit},playload){
            setTimeout(()=>{
                commit('addPlayload',playload)
            },1000)
        }
    }
})